<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
<meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
<title>我的收藏</title>
<link rel="stylesheet" type="text/css" href="../css/aui.css">
<link rel="stylesheet" type="text/css" href="../css/aui-slide.css">
<link rel="stylesheet" type="text/css" href="../css/aui-flex.css">
<link rel="stylesheet" type="text/css" href="../css/my.css">
<link rel="stylesheet" type="text/css" href="../css/index.css">
<link rel="stylesheet" type="text/css" href="../css/common.css">
<style>
.aui-tab-item.aui-active {
    color: #f43948;
    border-bottom: 2px solid #f43948;
}
.aui-radio:checked, .aui-radio.aui-checked, .aui-checkbox:checked, .aui-checkbox.aui-checked {
    background-color: #f55f80;
    border: solid 1px #f55f80;
    text-align: center;
    background-clip: padding-box;
}
.aui-radio, .aui-checkbox{ width:1rem; height:1rem;}
.aui-radio, .aui-checkbox{transition: unset;}
</style>
</head>

<body>
<!-- 顶部end --> 
<!-- 热门搜索 -->
<div class="aui-content" id="list">
    <!-- <div class="aui-card-list aui-margin-t-5">
        <div class="aui-media-list-item-inner aui-padded-10">
            <label class="aui-margin-r-10 hide" style="margin-top:1.6rem"><input class="aui-radio" type="checkbox" name="demo" checked=""></label>
            <div class="aui-list-item-media" style="width:20%">
                <img src="../image/pro01.jpg">
            </div>
            <div class="tb_zt_right aui-margin-l-10" style="width:40%">
                <div class="tb_zt_texttop">
                    <div class="tb_zt_text">
                        <div class="tb_zt_texticon">淘宝</div>
                        <div class="tb_zt_texttit">【爆款返厂】冬春色羊毛圆领</div>
                    </div>
                    <div class="tb_zt_bq">
                        
                    </div>
                </div>
                <div class="tb_zt_textbottom">
                    <div class="tb_numbar">
                        <div class="tb_price">¥59<span>¥136</span></div>
                        
                    </div>
                </div>
            </div>
        </div>
    </div> -->

</div>
<div class="h80"></div>
<footer class="aui-bar aui-bar-tab hide check">
    <div class="aui-bar-tab-item aui-border-r" style="width:40%;" tapmode>
        <label><input class="aui-radio check_all" type="checkbox" name="all"> 全选 </label>
    </div>
    <div class="aui-bar-tab-item aui-bg-danger jb aui-text-white" tapmode="" style="width: auto;" onclick="mulit_del()">批量删除</div>
</footer>
<!-- 固定底部end -->
</body>
<script type="text/javascript" src="../script/api.js"></script>
<script type="text/javascript" src="../script/zepto.min.js" ></script>
<script type="text/javascript" src="../script/doT.min.js" ></script>
<script type="text/javascript" src="../script/common.js" ></script>
<script type="text/javascript">
    var p=0,type=0;
    apiready = function(){
        api.parseTapmode();
        type = api.pageParam.other||0;
        //滚动监听
        api.addEventListener({
            name:'scrolltobottom',
            extra:{
                threshold:100 //设置距离底部多少距离时触发，默认值为0，数字类型
            }
        }, function(ret, err){        
            getData();
        });
        getData();
        //全选
        $('footer').on('change','.check_all',function(){
            var is_all = $(this).is(':checked');
            if(is_all==true){
                $('input[name=ids]').prop('checked',true);
            }else{
                $('input[name=ids]').prop('checked',false);
            }
        })
    }
    function getData(){
        p++;
        _loading2();
        _Ajax(window.APIServer.History,'post',{values:{p:p,type:type}},'json',function(ret){
            _loading2_close();
            //.渲染页面
            if (ret.code==1) {
                var evalText = doT.template($api.text($api.byId('goodslist')));
                $api.append($api.byId('list'), evalText(ret));
                imageCache('.goods_img');
            }else{
                p--;
                $('.loading-1').remove();
                $('#list').append('<div class="loading-1">'+ret.msg+'</div>');
            }
        });
    }
    //展开或隐藏
    function check(){
        if ($('.check').hasClass('hide')) {
            $('.check').removeClass('hide');
        }else{
            $('.check').addClass('hide');
        }
    }
    //全选-有冒泡
    function check_all(obj){
        var is_all = $(obj).find('input').is(':checked');
        if(is_all==false){
            $(obj).find('input').prop('checked',true);
            $('input[name=ids]').prop('checked',true);
        }else{
            $(obj).find('input').prop('checked',false);
            $('input[name=ids]').prop('checked',false);
        }
    }
    //批量删除
    function mulit_del(){
        var id_array=new Array();  
        $('input[name="ids"]:checked').each(function(){  
            id_array.push($(this).val());//向数组中添加元素  
        });
        if (id_array.length==0) {
            _toast('请选择');
            return false;
        }
        var idstr = id_array.join(',');//将数组元素连接起来以构建一个字符串 
        _loading2();
        _Ajax(window.APIServer.HistoryDel,'post',{values:{ids:idstr,type:type}},'json',function(ret){
            _loading2_close();
            //.渲染页面
            if (ret.code==1) {
                $('input[name="ids"]:checked').each(function(){  
                    $(this).parent().parent().remove(); 
                });  
            }else{
                _toast(ret.msg);
            }
        });
    }
</script>
<script id="goodslist" type="text/x-dot-template">
    {{ for (key in it.data){ }}
    <div class="aui-card-list aui-margin-t-5 li" style="margin-bottom:0;">
        <div class="aui-media-list-item-inner aui-padded-10">
            <label class="aui-margin-r-10 hide check" style="margin-top:1.6rem" tapmode ><input class="aui-radio" value="{{= it['data'][key]['id'] }}" type="checkbox" name="ids" ></label>
            <div class="aui-list-item-media" style="width:20%">
                <img class="goods_img" src="../image/faleimg.gif" _src="{{= it['data'][key]['pic'] }}">
            </div>
            <div class="tb_zt_right aui-margin-l-10" style="width:40%" onclick='open_goods({{= JSON.stringify(it['data'][key]) }})' tapmode>
                <div class="tb_zt_texttop">
                    <div class="tb_zt_text">
                        <div class="tb_zt_texticon"><img src="../image/{{? it['data'][key]['is_tmall']==0 }}taobao{{?? it['data'][key]['is_tmall']==1 }}tmall{{?? it['data'][key]['is_tmall']==2 }}jd{{?? it['data'][key]['is_tmall']==3 }}pinduoduo{{?}}.png"></div>
                        <div class="tb_zt_texttit"> {{= it['data'][key]['title'] }}</div>
                    </div>
                    <div class="tb_zt_bq">
                        
                    </div>
                </div>
                <div class="tb_zt_textbottom">
                    <div class="tb_numbar">
                        <div class="tb_price">¥{{= it['data'][key]['price_after_quan'] }}<span>¥{{= it['data'][key]['price'] }}</span></div>
                        
                    </div>
                </div>
            </div>
        </div>
    </div>
    {{ } }}
</script>
</html>
